package com.bit.book.enums;

import lombok.Getter;

@Getter
public enum BookStatus {

    DELETED(0, "无效"),
    NORMAL(1, "可借阅"),
    FORBIDDEN(2, "不可借阅");

    private int code;
    private String desc;

    BookStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BookStatus getDescByCode(int code){
        switch (code){
            case 0: return DELETED;
            case 1: return NORMAL;
            case 2: return FORBIDDEN;
            default: return null;
        }
    }
}
